package com.herui.ota.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.herui.ota.config.Constant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

/**
 * table name:  t_device
 * author name: amanda.shan
 * create time: 2023-10-26 16:51:33
 */ 
@Data
@ApiModel
@Accessors(chain = true)
@TableName("t_device")
public class Device extends LightBaseEntity{
	@TableId(type = IdType.AUTO)
	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty(value = "id")
	private Integer id;

	@ApiModelProperty(value = "品牌")
	private String brand;

	@ApiModelProperty(value = "打印类型")
	private String printType;
	@ApiModelProperty(value = "市场")
	private String market;

	@ApiModelProperty(value = "设备编号")
	private String deviceId;

	@ApiModelProperty(value = "版本号")
	private String version;

	@ApiModelProperty(value = "型号")
	private String type;

	@ApiModelProperty(value = "地区")
	private String area;

	@ApiModelProperty(value = "次数")
	private Integer count;
	@ApiModelProperty(value = "蓝牙名字")
	private String bluName;
	@ApiModelProperty(value = "设备uuid")
	private String deviceUuid;
	@ApiModelProperty(value = "渠道")
	private String channel;
	@ApiModelProperty(value = "系列")
	private String series;

	@JsonFormat(pattern = Constant.DATE_TIME_PATTERN, timezone="GMT+8")
	@ApiModelProperty(value = "激活时间")
	private Date activeTime;

	public String getTreeInfo(){
		StringBuilder treeInfo = new StringBuilder();
		if (!StringUtils.isEmpty(brand)){
			treeInfo.append(brand);
		}
		if (!StringUtils.isEmpty(printType)){
			treeInfo.append("-");
			treeInfo.append(printType);
		}
		if (!StringUtils.isEmpty(market)){
			treeInfo.append("-");
			treeInfo.append(market);
		}
		if (!StringUtils.isEmpty(series)){
			treeInfo.append("-");
			treeInfo.append(series);
		}
		if (!StringUtils.isEmpty(version)){
			treeInfo.append("-");
			treeInfo.append(version);
		}
		if (!StringUtils.isEmpty(type)){
			treeInfo.append("-");
			treeInfo.append(type);
		}
		return treeInfo.toString();
	}
}

